<?php


namespace app\api\logic;


use app\common\logic\BaseLogic;
use app\common\model\RechargeOrder;

class RechargeLogic extends BaseLogic
{
    /**
     * @notes 充值
     * @param $params
     * @return array
     * @author ljj
     * @date 2022/12/16 16:09
     */
    public function recharge($params)
    {
        $order = RechargeOrder::create([
            'sn'            => generate_sn((new RechargeOrder()),'sn'),
            'user_id'       => $params['user_id'],
            'order_terminal'=> $params['terminal'],
            'pay_way'       => $params['pay_way'],
            'order_amount'  => $params['money'],
        ]);

        return [
            'order_id' => $order->id,
            'from' => 'recharge'
        ];
    }
}